﻿// -----------------------------------------------------------------------
// <copyright file="UserMessage.cs" company="Abyssalsoft">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace Metal.User
{
    using System;
    using System.Collections.Generic;
    using System.Text;

    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    public static class UserMessage
    {
        /// <summary>
        /// Show user error
        /// </summary>
        /// <param name="exception">The exception object</param>
        public static void ShowError(Exception exception)
        {
            ErrorMessage message = new ErrorMessage();
            message.StackTrace = exception.StackTrace;
            message.ErrorTitle = exception.Message;
            message.ShowDialog();
        }

        /// <summary>
        /// Show a message that informs the user about something
        /// </summary>
        /// <param name="messageTitle">The title of the message</param>
        /// <param name="messageText">The message</param>
        public static void ShowInfoMessage(string messageTitle, string messageText)
        {
            InfoMessage message = new InfoMessage();
            message.MessageTitle = messageTitle;
            message.MessageText = messageText;
            message.ShowYesNoButtons = false;
            message.ShowDialog();
        }

        /// <summary>
        /// Show a message that informs the user about something
        /// </summary>
        /// <param name="messageTitle">The title of the message</param>
        /// <param name="messageText">The text of the message</param>
        /// <param name="yesNoButtons">Show YesNo buttons</param>
        /// <returns>Returns a value indicating whether the user had clicked Yes or No button</returns>
        public static bool ShowInfoMessage(string messageTitle, string messageText, bool yesNoButtons)
        {
            InfoMessage message = new InfoMessage();
            message.MessageTitle = messageTitle;
            message.MessageText = messageText;
            message.ShowYesNoButtons = yesNoButtons;
            message.ShowDialog();
            return message.UserChoice();
        }
    }
}
